//
//  bfaMainWindowViewController.m
//  Basson Fingering App
//
//  Created by mac on 10/18/12.
//  Copyright (c) 2012 Team Basson Fingering App. All rights reserved.
//

#import "bfaMainWindowViewController.h"

@interface bfaMainWindowViewController ()

@end

@implementation bfaMainWindowViewController
@synthesize location, noteImage1, noteImage2, noteImage3, fingering1, fingering2, fingering3, altFingerLabel, noteSharpFlatImage1, noteSharpFlatImage2, noteSharpFlatImage3;

- (IBAction)fingerSwipedRight:(UIGestureRecognizer *) recognizer
{
    if(noteNum == 1)
    {
        if(noteImage1.center.y >= 71 && noteImage1.center.y < 72)
        {
            if(noteImage1.center.y >= 71 && noteImage1.center.y < 72)
            {
                if(altNum == 3)
                {
                    altNum = 2;
                    altFingerLabel.text = @"2 of 3 fingerings";
                    fingeringImage2 = [UIImage imageNamed:@"F2.png"];
                    [self.fingering2 setImage:fingeringImage2];
                }
                else if(altNum == 2)
                {
                    altNum = 1;
                    altFingerLabel.text = @"1 of 3 fingerings";
                    fingeringImage2 = [UIImage imageNamed:@"C.png"];
                    [self.fingering2 setImage:fingeringImage2];
                }
                else if(altNum == 1)
                {
                    altNum = 3;
                    altFingerLabel.text = @"3 of 3 fingerings";
                    fingeringImage2 = [UIImage imageNamed:@"A.png"];
                    [self.fingering2 setImage:fingeringImage2];
                }
            }
        }
    }
}

- (IBAction)fingerSwipedLeft:(UIGestureRecognizer *) recognizer
{
    if(noteNum == 1)
    {
        if(noteImage1.center.y >= 71 && noteImage1.center.y < 72)
        {
            if(altNum == 1)
            {
                altNum = 2;
                altFingerLabel.text = @"2 of 3 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"F2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(altNum == 2)
            {
                altNum = 3;
                altFingerLabel.text = @"3 of 3 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"A.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(altNum == 3)
            {
                altNum = 1;
                altFingerLabel.text = @"1 of 3 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"C.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
    }
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    altFingerLabel.text = @"1 of 3 fingerings";
    altFingerLabel.hidden = false;

    // initialize images
    noteNum = 1;
    noteImage2.hidden = YES;
    noteImage3.hidden = YES;
    fingering1.hidden = YES;
    fingering3.hidden = YES;
    blockChangeSharpFlat = NO;
    
    noteSharpFlatImage1.hidden = YES;
    noteSharpFlatImage2.hidden = YES;
    noteSharpFlatImage3.hidden = YES;
    
    noteSharpFlatImage1.center = CGPointMake(noteImage1.center.x-24, noteImage1.center.y);
    noteSharpFlatImage2.center = CGPointMake(noteImage2.center.x-24, noteImage2.center.y);
    noteSharpFlatImage3.center = CGPointMake(noteImage3.center.x-24, noteImage3.center.y);
    
    sharpImage = [UIImage imageNamed:@"sharp.png"];
    flatImage = [UIImage imageNamed:@"flat.png"];
    
    fingeringImage1 = [UIImage imageNamed:@"C.png"];
    fingeringImage2 = [UIImage imageNamed:@"C.png"];
    fingeringImage3 = [UIImage imageNamed:@"C.png"];
    
    [self.fingering1 setImage:fingeringImage1];
    [self.fingering2 setImage:fingeringImage2];
    [self.fingering3 setImage:fingeringImage3];
    
    // create long tap recognizer for each note
    UITapGestureRecognizer *noteImage1Tap;
    UITapGestureRecognizer *noteImage2Tap;
    UITapGestureRecognizer *noteImage3Tap;
    
    // initialize them
    noteImage1Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapNote1:)];
    noteImage2Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapNote2:)];
    noteImage3Tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapNote3:)];
    
    // fix touch priority
    [noteImage1Tap setDelaysTouchesBegan:NO];
    [noteImage2Tap setDelaysTouchesBegan:NO];
    [noteImage3Tap setDelaysTouchesBegan:NO];
    
    [noteImage1Tap setCancelsTouchesInView:NO];
    [noteImage2Tap setCancelsTouchesInView:NO];
    [noteImage3Tap setCancelsTouchesInView:NO];
    
    // attach them
    [self.noteImage1 addGestureRecognizer:noteImage1Tap];
    [self.noteImage2 addGestureRecognizer:noteImage2Tap];
    [self.noteImage3 addGestureRecognizer:noteImage3Tap];    
    
	// Do any additional setup after loading the view.
}

-(void)handleTapNote1: (UITapGestureRecognizer *)sender {
    
    if (blockChangeSharpFlat == YES) {
        return;
    }
    if (noteSharpFlatImage1.hidden == YES) {
        // no sharp or flat assigned, assign sharp
        noteSharpFlatImage1.hidden = NO;
        [self.noteSharpFlatImage1 setImage:sharpImage];
    } else if (noteSharpFlatImage1.hidden == NO && [self.noteSharpFlatImage1 image] == sharpImage){
        // sharp image assigned, assign flat
        [self.noteSharpFlatImage1 setImage:flatImage];
    } else if (noteSharpFlatImage1.hidden == NO && [self.noteSharpFlatImage1 image] == flatImage){
        // flat image assigned, assign none
        noteSharpFlatImage1.hidden = YES;
    } else {
        NSLog(@"Something broke...");
    }
}

-(void)handleTapNote2: (UITapGestureRecognizer *)sender {
    if (blockChangeSharpFlat == YES) {
        return;
    }
    if (noteSharpFlatImage2.hidden == YES) {
        // no sharp or flat assigned, assign sharp
        noteSharpFlatImage2.hidden = NO;
        [self.noteSharpFlatImage2 setImage:sharpImage];
    } else if (noteSharpFlatImage2.hidden == NO && [self.noteSharpFlatImage2 image] == sharpImage){
        // sharp image assigned, assign flat
        [self.noteSharpFlatImage2 setImage:flatImage];
    } else if (noteSharpFlatImage2.hidden == NO && [self.noteSharpFlatImage2 image] == flatImage){
        // flat image assigned, assign none
        noteSharpFlatImage2.hidden = YES;
    } else {
        NSLog(@"Something broke...");
    }
}

-(void)handleTapNote3: (UITapGestureRecognizer *)sender {
    if (blockChangeSharpFlat == YES) {
        return;
    }
    if (noteSharpFlatImage3.hidden == YES) {
        // no sharp or flat assigned, assign sharp
        noteSharpFlatImage3.hidden = NO;
        [self.noteSharpFlatImage3 setImage:sharpImage];
    } else if (noteSharpFlatImage3.hidden == NO && [self.noteSharpFlatImage3 image] == sharpImage){
        // sharp image assigned, assign flat
        [self.noteSharpFlatImage3 setImage:flatImage];
    } else if (noteSharpFlatImage3.hidden == NO && [self.noteSharpFlatImage3 image] == flatImage){
        // flat image assigned, assign none
        noteSharpFlatImage3.hidden = YES;
    } else {
        NSLog(@"Something broke...");
    }
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [[event allTouches] anyObject];
    location = [touch locationInView:self.view];
    if([touch view] == noteImage1)
    {
        selected = 1;
        noteImage1.center = CGPointMake(120,location.y-20);
        
    }
    else if([touch view] == noteImage2)
    {
        selected = 2;
        noteImage2.center = CGPointMake(180,location.y-20);
    }
    else if([touch view] == noteImage3)
    {
        noteImage3.center = CGPointMake(240,location.y-20);
        selected = 3;
    }
    else
    {
        selected = 0;
    }
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    blockChangeSharpFlat = YES;
    [self touchesBegan:touches withEvent:event];
    int yloc = location.y - 20;
    //prevents the user from dragging the image too high
    if(yloc <= 20)
    {
        if(selected == 1)
            noteImage1.center = CGPointMake(120, 20);
        else if(selected == 2)
            noteImage2.center = CGPointMake(180, 20);
        else if(selected == 3)
            noteImage3.center = CGPointMake(240, 20);
        
    }
    //prevents the user from dragging the image too low
    if(yloc >= 160)
    {
        if(selected == 1)
            noteImage1.center = CGPointMake(120, 160);
        else if(selected == 2)
            noteImage2.center = CGPointMake(180, 160);
        else if(selected == 3)
            noteImage3.center = CGPointMake(240, 160);
    }
    // sharp/flat image moves with note
    noteSharpFlatImage1.center = CGPointMake(noteImage1.center.x-24, noteImage1.center.y);
    noteSharpFlatImage2.center = CGPointMake(noteImage2.center.x-24, noteImage2.center.y);
    noteSharpFlatImage3.center = CGPointMake(noteImage3.center.x-24, noteImage3.center.y);
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    int yloc = location.y - 20;
    // places note on the F line of clef
    if(yloc <= 44)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 39);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"F2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"F2.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 39);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"F2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"F2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 39);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"F2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the E space of clef
    else if(yloc > 44 && yloc <= 54)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 49);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"E2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"E2.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 49);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"E2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"E2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 49);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"E2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the G line of clef
    else if(yloc > 54 && yloc <= 65)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 60);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"G2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"G2.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 60);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"G2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"G2.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 60);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"G2.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the C space of clef
    else if(yloc > 65 && yloc <= 76)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 71);
            if(noteNum == 1)
            {
                altNum = 1;
                altFingerLabel.text = @"1 of 3 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"C.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"C.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 71);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"C.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"C.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 71);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"C.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the B line of clef
    else if(yloc > 76 && yloc <= 87)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 82);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"B.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"B.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 82);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"B.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"B.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 82);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"B.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the A space of clef
    else if(yloc > 87 && yloc <= 97)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 92);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"A.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"A.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 92);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"A.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"A.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 92);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"A.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the G line of clef
    else if(yloc > 97 && yloc <= 108)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 102);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"G.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"G.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 102);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"G.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"G.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 102);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"G.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the F space of clef
    else if(yloc > 108 && yloc <= 119)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 113);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"F.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"F.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 113);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"F.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"F.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 113);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"F.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // places note on the E line of clef
    else if(yloc > 119)
    {
        if(selected == 1)
        {
            noteImage1.center = CGPointMake(120, 124);
            if(noteNum == 1)
            {
                altFingerLabel.text = @"1 of 1 fingerings";
                fingeringImage2 = [UIImage imageNamed:@"E.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
            else if(noteNum == 2 || noteNum == 3)
            {
                fingeringImage1 = [UIImage imageNamed:@"E.png"];
                [self.fingering1 setImage:fingeringImage1];
            }
        }
        else if(selected == 2)
        {
            noteImage2.center = CGPointMake(180, 124);
            if(noteNum == 2)
            {
                fingeringImage3 = [UIImage imageNamed:@"E.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
            else if(noteNum == 3)
            {
                fingeringImage2 = [UIImage imageNamed:@"E.png"];
                [self.fingering2 setImage:fingeringImage2];
            }
        }
        else if(selected == 3)
        {
            noteImage3.center = CGPointMake(240, 124);
            if(noteNum == 3)
            {
                fingeringImage3 = [UIImage imageNamed:@"E.png"];
                [self.fingering3 setImage:fingeringImage3];
            }
        }
    }
    // update sharp/flat symbol and blocking boolean
    noteSharpFlatImage1.center = CGPointMake(noteImage1.center.x-24, noteImage1.center.y);
    noteSharpFlatImage2.center = CGPointMake(noteImage2.center.x-24, noteImage2.center.y);
    noteSharpFlatImage3.center = CGPointMake(noteImage3.center.x-24, noteImage3.center.y);
    blockChangeSharpFlat = NO;
}

-(NSString *)getString:(int) val
{
    if(val == 39)
        return @"F2.png";
    if(val == 49)
        return @"E2.png";
    if(val == 60)
        return @"G2.png";
    if(val == 71)
        return @"C.png";
    if(val == 82)
        return @"B.png";
    if(val == 92)
        return @"A.png";
    if(val == 102)
        return @"G.png";
    if(val == 113)
        return @"F.png";
    if(val == 124)
        return @"E.png";
    else
        return @"C.png";
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)addNotePush:(id)sender {
    if(noteImage2.hidden == true)
    {
        int y;
        noteImage2.hidden = false;
        fingering1.hidden = false;
        fingering2.hidden = true;
        fingering3.hidden = false;
        y = noteImage1.center.y;
        fingeringImage1 = [UIImage imageNamed:[self getString:y]];
        [self.fingering1 setImage:fingeringImage1];
        y = noteImage2.center.y;
        fingeringImage3 = [UIImage imageNamed:[self getString:y]];
        [self.fingering3 setImage:fingeringImage3];
        altFingerLabel.hidden = true;
        noteNum = 2;
    }
    else if(noteImage3.hidden == true)
    {
        int y;
        noteImage3.hidden = false;
        fingering1.hidden = false;
        fingering2.hidden = false;
        fingering3.hidden = false;
        y = noteImage1.center.y;
        fingeringImage1 = [UIImage imageNamed:[self getString:y]];
        [self.fingering1 setImage:fingeringImage1];
        y = noteImage2.center.y;
        fingeringImage2 = [UIImage imageNamed:[self getString:y]];
        [self.fingering2 setImage:fingeringImage2];
        noteNum = 3;
    }
}

- (IBAction)removeNotePush:(id)sender {
    if(noteImage3.hidden == false)
    {
        int y;
        noteImage3.hidden = true;
        fingering1.hidden = false;
        fingering2.hidden = true;
        fingering3.hidden = false;
        y = noteImage1.center.y;
        fingeringImage1 = [UIImage imageNamed:[self getString:y]];
        [self.fingering1 setImage:fingeringImage1];
        y = noteImage2.center.y;
        fingeringImage3 = [UIImage imageNamed:[self getString:y]];
        [self.fingering3 setImage:fingeringImage3];
        noteNum = 2;
    }
    else if(noteImage2.hidden == false)
    {
        int y;
        noteImage2.hidden = true;
        fingering1.hidden = true;
        fingering2.hidden = false;
        fingering3.hidden = true;
        y = noteImage1.center.y;
        fingeringImage2 = [UIImage imageNamed:[self getString:y]];
        [self.fingering2 setImage:fingeringImage2];
        altFingerLabel.hidden = false;
        noteNum = 1;
    }
}

@end
